import { ParsedArgs } from 'minimist';
import { CmdMap } from './types';
import { spawn } from 'p-spawn';
import { getDevConfig } from './conf';


export const cmds: CmdMap = {
	test, testd
}

// --------- /Public Types --------- //


async function test(argv: ParsedArgs) {
	const configs = await getDevConfig();
	await spawn('tsc', ["-p", "../tsconfig.json"], { cwd: "test/", toConsole: true });
	await spawn("./node_modules/.bin/mocha", ["--opts", "mocha.opts"], { toConsole: true });
}

async function testd(argv: ParsedArgs) {
	const configs = await getDevConfig();
	await spawn('tsc', ["-p", "../tsconfig.json"], { cwd: "test/", toConsole: true });
	await spawn("./node_modules/.bin/mocha", ["--inspect-brk", "--inspect", "--opts", "mocha.opts"], { toConsole: true });
}




